home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / datatypes / playdt13.lha / PlayDT / PlayDT-src / PlayDT.c next >
C/C++ Source or Header  |  1997-06-05  |  2KB  |  84 lines

  1. /****************************************************************
  2.  *
  3.  * $VER: PlayDT.c 1.3 (4.6.97) Tak Tang (tst92@ecs.soton.ac.uk)
  4.  *
  5.  * Usage : PlayDT FILE/M REQUESTER/S
  6.  *    or : (From workbench) as the default tool in a project icon
  7.  *
  8.  * Description : Plays sound samples using datatypes.
  9.  *               Supports pattern matching.
  10.  *
  11.  * Copyright © 1997 Tak Tang
  12.  *
  13.  * You may use any part of this source code in your own programs
  14.  * provided that it is not called PlayDT.
  15.  *
  16.  *****************************************************************/
  17.  
  18.  
  19. /**** Header files ****/
  20.  
  21. #include "PlayDT.h"
  22.  
  23. #include <exec/memory.h>
  24.  
  25. #include <workbench/startup.h>
  26.  
  27. #include <clib/dos_protos.h>
  28. #include <clib/exec_protos.h>
  29.  
  30. #include <pragmas/dos_pragmas.h>
  31. #include <pragmas/exec_pragmas.h>
  32.  
  33.  
  34. /**** Storage ****/
  35.  
  36. UBYTE VersTag[]="\0$VER: " PROGNAME " " PROGVER " " PROGDATE;
  37.  
  38. extern struct Library *DOSBase;
  39. struct Library *IntuitionBase;
  40. struct Library *DataTypesBase;
  41.  
  42.  
  43. /**** Main entry ****/
  44.  
  45. void main(int argc, char **argv)
  46. {
  47.   struct ExecBase *SysBase = (*((struct ExecBase **) 4));
  48.   struct GlobalData *gd;
  49.  
  50.   gd = AllocVec (sizeof (struct GlobalData), MEMF_CLEAR);
  51.   if ( gd )
  52.   {
  53.     gd->SysBase = SysBase;
  54.     if (gd->DataTypesBase = OpenLibrary ("datatypes.library", 39L))
  55.     {
  56.       DataTypesBase=gd->DataTypesBase;
  57.  
  58.       gd->MeTask=(ULONG) FindTask (NULL);  /* Cache this task */
  59.  
  60.       if (0==argc)
  61.       {
  62.         UseWB( gd, (struct WBStartup *)argv );
  63.       } /* run from workbench */
  64.       else
  65.       {
  66.         UseCLI( gd);
  67.       } /* run from shell */
  68.  
  69.       if (gd->IntuitionBase) CloseLibrary(gd->IntuitionBase);
  70.  
  71.       CloseLibrary(gd->DataTypesBase);
  72.     } /* if OpenLibrary(DataTypes) OK */
  73.     else
  74.     {
  75.       PrintFault (IoErr (), MSG_FAILED);
  76.     } /* if OpenLibrary(DataTypes) failed */
  77.     FreeVec (gd);
  78.   } /* if AllocVec(struct GlobalData) */
  79. } /* main() */
  80.  
  81.  
  82. /**** End of file ****/
  83.  
  84.